class Solution:
    def addBinary(self, a: str, b: str) -> str:
        def binary2decimal(numerical):
            sum = 0
            for i in range(len(numerical) -1, -1, -1):
                sum += pow(2, len(numerical) - i -1) * int(numerical[i])
            return sum 
        
        return bin(binary2decimal(a) + binary2decimal(b))[2:]

class Solution:
    def addBinary(self, a: str, b: str) -> str:
        a = a[::-1]
        b = b[::-1]
        if len(a) <= len(b):
            a, b = a, b
        else:
            a, b = b, a
        res = str()
        flag = 0
        for i in range(len(b)):
            if i < len(a):
                tmp = int(a[i]) + int(b[i]) + flag
            else:
                tmp = int(b[i]) + flag
            if  tmp >= 2:
                flag = 1
                res += str(tmp - 2)
            else:
                flag = 0
                res += str(tmp)
        if flag:
            res += str(1)
        return res[::-1]